package com.lwgk.mvp.view;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.LinearLayout;

import com.lwgk.R;
import com.lwgk.mvp.model.SplashPresent;
import com.lwgk.mvp.presenter.SplashPresentImpl;
import com.lwgk.mvp.presenter.SplashView;
import com.lwgk.utils.StatusBarUtils;
/**
 * created by 赵航
 * 联系微信 微信号：zhao--hang--
 * on 2019/7/10
 * --------------------------------------------------------------------------
 * 描述：该界面为闪屏界面，命名规则是****Activity
 * 注意事项：
 */
public class SplashActivity extends AppCompatActivity implements SplashView {
    private LinearLayout mSplashParent;
    private SplashPresentImpl mSplashPresent;
    private String mAction;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //设置沉寝式状态栏
        StatusBarUtils.setStatusTransparent(SplashActivity.this);
        //设置文字颜色是黑色
        StatusBarUtils.setLightMode(SplashActivity.this);
        setContentView(R.layout.activity_splash);
        //MVP第一步，采用多肽形式将该类的对象参数传递给接口的实现类
        mSplashPresent = new SplashPresent(SplashActivity.this);

        Intent intent = getIntent();
        //MVP第三部：关联业务
        mSplashPresent.checkActionSkip(intent);

    }
    //当为false时，表示是第一次进来
    @Override
    public void openNormalApp(boolean b) {

        if(b){
            //跳转到主界面
            startActivity(new Intent(SplashActivity.this,HomeActivity.class));
            finish();
        }else {
            //跳转到翻图界面
            startActivity(new Intent(SplashActivity.this,SplashSmoothPlateActivity.class));
            finish();
        }

    }
}
